<?php

	include_once("Database.class.php");

	class Login{
		public $db;
		public $loggedUser;
		
		function Login(){
			$this->db = new Database();
		}
		
		function Login($username, $password){
			$this->db = new Database();			
			return login($username, $password);
		}
		
		function login($username, $password){						
			$sql = "select * from usuarios where username='$username' and password='$password'";
			$data_array = $this->db->runQuery($sql);
			if(!empty($data_array)){				
				foreach($data_array[0] as $fieldName => $fieldValue){
					$this->{$fieldName}=$fieldValue;
				}
			}
		}
	}

?>